package ird.demo.repository;

import ird.demo.domain.Menu;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface MenuRepository extends BaseRepository< Menu, String>{
	@Query(value = "FROM Menu WHERE menuSuppInd='0' and id.menuId in (select id.menuId from UsrGrpMenu where id.usrGrp=:usrGrp)")
	public List<Menu> findMenuByGrp(@Param("usrGrp") String usrGrp);
	
	@Query(value = "FROM Menu order by menuId")
	public List<Menu> findAllMenu();
	
	@Query(value = "select m FROM Menu m, Transaction t where m.menuId=t.menuId and t.tranId=:tranId")
	public Menu findMenuByTranId(@Param("tranId") String tranId);
}